Write a C# Sharp program to create a new list from a given list of strings where each element has "#" added at the beginning and end position
- برمجة سي شارب
- برمجة
- 2021-05-17
- MarwaMohammed
الأجوبة
using System;
using System.Collections.Generic;
using System.Linq;
namespace exercises
{
class Program
{
static void Main(string[] args)
{
List mylist = test(new List(new string[] { "1", "2", "3" , "4" }));
foreach(var i in mylist)
{
Console.Write(i.ToString()+" ");
}
}
public static List test(List nums_str)
{
IEnumerable s = nums_str.Select(x => "#" + x + "#");
return s.ToList();
}
}
}أسئلة مشابهة
القوائم الدراسية التي ينتمي لها السؤال
